//ZADATAK00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication56
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] a = new string[n];
            int br = 0;

            for (int i = 0; i < n; i++)
            {
                a[i] = Console.ReadLine();
                if (a[i].Length < 5)
                {
                    br++;
                }
                if (a[i][0] == 'A')
                {
                    br++;
                }
            }
		Console.WriteLine(br);
		Console.ReadKey();
        }
    }
}



//ZADATAK01
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication14
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] a = new int[n];
            int t = 0;
            int m = 0;
            
            for (int i = 0; i < n - 1; i++)
            {
                if (a[i] > a[i+1])
                    {
                        t = a[i+1];
                        a[i+1] = a[i];
                        a[i] = t;
                    }
            }
            m = n/2;
	    m++;
            m = a[m];

            Console.WriteLine(m);
            Console.ReadKey();
        }
    }
}


//ZADATAK02
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication99
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> prosta = new List<int>();

            for (int i = 2; i < 100; i++)
            {
                for (int j = i * 2; j < 100; j = j + i)
                {
                    if (!prosta.Contains(j))
                    {
                        prosta.Add(j);
                    }
                }
            }
            for (int z = 2; z < 100; z++)
            {
                if (!prosta.Contains(z))
                {
                    Console.WriteLine(z);
                }
            }
            Console.ReadKey();
        }
    }
}

//ZADATAK03
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication74
{
    class Program
    {
        static void Main(string[] args)
        {
            int n=Convert.ToInt32(Console.ReadLine());
            int[][] a = new int[n][];
            int maks = 0;
            int tri = 0;
            double proc = 0;
            int proci = 0;
            int br = 0;

            for (int i = 0; i < n; i++)
            {
                tri=0;
                Console.WriteLine("kolko ima ocena?");
                int m=Convert.ToInt32(Console.ReadLine());
                for (int j = 0; j < m; j++)
                {
                    if (maks < m) { maks = m; }
                    a[i][j]=Convert.ToInt32(Console.ReadLine());
                    if (a[i][j] == 3) { tri++; }
                }
                if (proc < m / tri) 
                { 
                    proc = m / tri;
                    proci = i;
                }
            }
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < maks; j++)
                {
                    if (a[i][j] == 0)
                    {
                        br++;
                    }
                }
            }
		Console.WriteLine(br);
		Console.WriteLine(proci);
		Console.ReadKey();
        }
    }
}